﻿using MediatR;
using RBAC.MaHaiBo.API.Application.Command.MenuRoleCommand;
using RBAC.MaHaiBo.Service;

namespace RBAC.MaHaiBo.API.Application.CommandHandlers.MenuRoleHandler
{
    public class BackillMenuRoleCommandHandler:IRequestHandler<BackillMenuRoleCommand, List<int>>
    {
        /// <summary>
        /// 角色菜单关联服务层
        /// </summary>
        IMenuRoleService mrSer;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="mrSer">角色菜单关联服务层</param>
        public BackillMenuRoleCommandHandler(IMenuRoleService mrSer)
        {
            this.mrSer = mrSer;
        }

        public async Task<List<int>> Handle(BackillMenuRoleCommand request, CancellationToken cancellationToken)
        {
            return await mrSer.BackillMenuRole(request.Rid);
        }
    }
}
